package com.rongji.tools.temp.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.rongji.tools.temp.domain.Test;
import com.rongji.tools.temp.service.TestService;
import com.rongji.tools.temp.mapper.TestMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
* @author Administrator
* @description 针对表【test】的数据库操作Service实现
* @createDate 2023-06-20 10:22:08
*/
@RequiredArgsConstructor
@Service
public class TestServiceImpl extends ServiceImpl<TestMapper, Test>
    implements TestService{


    private final TestMapper mapper;



    @Override
    public int getNum(String id){
       Test test= mapper.selectById(id);
       return  test.getTotal();
    }

    @Override
    public void minusOne(String id) {
        Test test= mapper.selectById(id);
        int total= test.getTotal();
        test.setTotal(total-1);
        mapper.updateById(test);
    }
}




